package com.api.organization.deleteuser;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IOrganizationApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/organization/organization-context.xml" })
public class DeleteExternalUserAdministrator extends AbstractApiTest {

	@Value("#{org_editOrganization[administrator].appId}")
	private String userId;

	@Value("#{org_editOrganization[administrator].password}")
	private String userPassword;

	@Value("#{org_editOrganization[externalContact].appId}")
	private String userAddedUrn;

	@BeforeClass
	public void setUpVariables() {

		getApi().login(userId, userPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public synchronized void testAddUserWithoutDelegating() throws ZyncroApiException {

		String receptionUserUrn = null;

		getApi().getService(IOrganizationApiService.class).deleteUser(userAddedUrn, receptionUserUrn);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public synchronized void testAddUserDelegating() throws ZyncroApiException {

		getApi().getService(IOrganizationApiService.class).deleteUser(userAddedUrn, userId);
	}
}
